#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import sys
from operator import itemgetter



def deal(lines):

    if(len(lines)==1):
        lines[0][0]=str(60)
        print current_nasid+"\t"+"\t".join(lines[0])+"\t"+"1"+"\t"+"1" #入口页 出口页
    else:
        slines=sorted(lines,key=itemgetter(0))
        result=[]
        slines[0].extend(['1','0'])
        first=slines[0]
        for item in slines[1:]:
            duration = (int(item[0])-int(first[0]))/1000.0
            first[0]=str(duration)
            result.append(first)
            item.extend(['0','0'])
            first=item
        first[0]=str(60)
        first[-1]="1"
        result.append(first)

        for finalitem in result:
            print current_nasid+"\t"+"\t".join(finalitem)
current_nasid=None
lines=[]
for line in sys.stdin:

    #other=time,cid,aid,day,cookie,ep,ip,sis,sisurl,referer_type
    nasid,others = line.strip().split("\t",1)

    if current_nasid == nasid:
        lines.append(others.split("\t"))
    else:
        if current_nasid :
            deal(lines)

        current_nasid = nasid

        lines=[]
        lines.append(others.split("\t"))

if lines :
    deal(lines)

